<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html;charset=UTF-8"%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>员工列表页面</title>
    <base href="http://localhost:8080/My_CRUD/">
</head>
<body>

<a href="add.jsp">[新增员工]</a>

<script type="text/javascript">
    function del(employee_id){
        var ok = window.confirm("注意！删除的信息将不可恢复！");
        if(ok){
            document.location.href = "${pageContext.request.contextPath}/emp/delete?employee_id=" + employee_id;
        }
    }
</script>

<h1 align="center">员工列表</h1>
<hr >
<table border="1px" align="center" width="50%">
    <tr>
        <th>员工号</th>
        <th>员工姓名</th>
        <th>电话号码</th>
        <th>工作号</th>
        <th>工资</th>
        <th>操作</th>
    </tr>

    <c:forEach items="${empList}" varStatus="empStatus" var="emp">
        <tr>
            <td>${emp.employee_id}</td>
            <td>${emp.name}</td>
            <td>${emp.phone_number}</td>
            <td>${emp.job_id}</td>
            <td>${emp.salary}</td>
            <td>
                <a href="javascript:void(0)" onclick="del(${emp.employee_id})">删除</a>
                <a href="emp/detail?f=edit&employee_id=${emp.employee_id}">修改</a>
            </td>
        </tr>
    </c:forEach>
</table>

</body>
</html>
